﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="plrukuadd.aspx.cs" Inherits="UI.system.page.rawdata.plrukuadd" %>

<%@ Import Namespace="Model" %>
<%@ Import Namespace="Common" %>

<style>
    .main{ height:100%; width:75%; margin-left:10px; float:left;}
    #img_k{width:100%;  height:auto;  position:relative;}
    #img_panel{width:auto; height:auto;}
    #img_panel  div{ float:left; margin-right:15px; position:relative; margin-bottom:10px;}
    #img_panel  div img{width:80px; height:80px; overflow:hidden; float:left; text-align:left; border:1px solid #cdcdcd; object-fit: cover;}
    #img_panel  div .delete{cursor:pointer; position:absolute; padding:0px; right:-20px; top:-8px; width:20px; height:20px; background:url(/system/img/delete.png);}
    #img_panel  div .delete img{border:0px; width:20px; height:20px;}
    #img_panel #add-photo{width:80px; height:80px; background-image:url(/system/img/add-photo.png); background-size:80px 80px;  padding-top:10px; float:left;}    
    .upload_img{ padding-top:8px;}
    #chuanpinimg{ float:left;}
    .layui-input-block textarea{ margin:0px; padding:0 0 0px 10px; line-height:25px;}
</style>
<div style="margin: 15px;">
	<form class="layui-form" style="padding-left:0px;">
        <div style=" height:30px; line-height:28px; font-size:20px; text-align:center; margin-bottom:10px;">
            已选择 <span style="color:Red;"><%=count %></span> 条数据进行入库操作
        </div>
        <div class="layui-form-item">
			<label class="layui-form-label" style="float:left;"><font>仓位</font><em>*</em></label>
			<div class="layui-input-block">				
                <div style="width:90%; float:left;">
				<select id="pid" name="pid" lay-verify="required" lay-filter="sendtype">
                    <option>请选择</option>  
                        <%foreach (PositionInfo info in positionlist)
                          {
                              if (info!=null)
                              {
                              %>
                        
					      <option value="<%=info.ID %>"><%=info.Code %></option>   
					    <%}} %>
				</select>
                </div>
                <div style="width:10%; float:left;">
                    <a class="layui-btn layui-btn-small  layui-btn-warm" style="float:right;height: 38px;line-height: 38px;" onclick="saomiao();">扫描</a>
               </div>
               <div><input id="saomiao" style="border:0px; color:#fff; height:1px;" /> </div>
			</div>
		</div>       
        <div class="layui-form-item">
			<label class="layui-form-label"><font>操作人</font><em>*</em></label>
			<div class="layui-input-block">
                <input type="text" name="username" placeholder="请输入操作人" lay-verify="required" readonly="readonly" autocomplete="off" class="layui-input" value="<%=aname %>" style=" background-color:#f2f2f2;">               
			</div>           
		</div>
        <div class="layui-form-item">
			<label class="layui-form-label" id="chuanpinimg">图片</label>
            <div class="main">
                <div id="img_k"><div id="img_panel" class="imgview"></div><div id="add-photo"></div></div>
            </div>        
		</div>

		<a lay-filter="save" lay-submit style="display: none;"></a>        
	</form>
</div>
<script language="javascript">
        layui.use(["form", "table", "laydate"], function () {
            var $ = layui.jquery, form = layui.form, laydate = layui.laydate;
            table = layui.table;
            laydate.render({
                elem: '#hpdate',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss' //可任意组合
            });
        });
       Init_Annex()
        function Init_Annex() {
            $("#hpdate").val(getNowFormatDate());
//            $('#img_k').html('<div id="img_panel" class="imgview"></div><div id="add-photo"></div>');
//            if(Imgs != 0){
//                var data = JSON.stringify(Imgs);
//                var jsonData = JSON.parse(data);
//                var st = jsonData;
//                var str = new Array();
//                str = st.toString().split(',');
//                var html = "";                
//                for(var i=0;i<str.length;i++){
//                    html += '<div id="Imgs"><img data-original="' + str[i] + '" src="' + str[i] + '"/><input type="hidden" value="'+str[i]+'"><div id="' + str[i] + '" class="delete" onclick="RemoveFile(this)"></div></div>';
//                }
//                $("#img_panel").html(html);               
//            } else {
//                //$("#img_panel").html("暂无图片&nbsp;&nbsp;");
//            }
            var upload = new Upload_File("add-photo", null, 80, 80, "/system/img/add-photo.png", true);
            upload.swfu.handle = "upload_annex";
        };
   
   function saomiao(){
            $("#saomiao").val("");
            $("#saomiao").focus();
            $("#saomiao").keydown(function (event) {
                if (event.keyCode == "13") {
                    var array = new Array();  //定义数组     
                    $("#pid option").each(function () {  //遍历所有option    
                        var channlVal = $(this).text();   //获取option值     
                        if (channlVal != '') {
                            array.push(channlVal);  //添加到数组中    
                        }
                    })
                    var values = array;
                    var va = $("#saomiao").val();

                    var str = new Array();
                    str = values.toString().split(',');
                    var bo = 0;
                    for (var i = 0; i < str.length; i++) {
                        if (va == str[i]) {
                            bo = 1;
                        }
                    }

                    $("#pid option:selected").removeAttr("selected");
                    //$("#pid").find("option:contains(请选择)").removeAttr("selected");


                    if (bo > 0) {
                        $("#pid").find("option:contains(" + va + ")").prop("selected", true);
                        $("#pid").find("option:contains(" + va + ")").siblings().prop("selected", false);
                    } else {
                        $("#pid").find("option:contains(请选择)").prop("selected", true);
                        $("#pid").find("option:contains(请选择)").siblings().prop("selected", false);                        
                        LayerBox.Error("没有找到该仓位");
                    }
                    form.render();

                }
            });   
        }
</script>